//
//  SongListTableViewCell.m
//  MMLOOK
//
//  Created by BraveMatch on 15/10/7.
//  Copyright (c) 2015年 武俊娥. All rights reserved.
//

#import "SongListTableViewCell.h"
#import "MyMusicModel.h"
#import "UIImageView+WebCache.h"
#define OffWidth [UIScreen mainScreen].bounds.size.width / 375
#define OffHeight [UIScreen mainScreen].bounds.size.height / 667
@interface SongListTableViewCell ()
@property (nonatomic, retain) UILabel *songNameLabel;
@property (nonatomic, retain) UILabel *singerNameLabel;
@property (nonatomic, retain) UILabel *favoritesLabel;
@property (nonatomic, retain) UIImageView *heart;

@property (nonatomic, retain) UIImageView *showImage;
//@property (nonatomic, retain) UILabel *

@end

@implementation SongListTableViewCell
- (void)dealloc
{
    [_favoritesLabel release];
    [_singerNameLabel release];
    [_songNameLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        self.songNameLabel = [[UILabel alloc]
        initWithFrame:CGRectMake(50, 5, 300*OffWidth, 60*OffHeight)];
        self.songNameLabel.backgroundColor = [UIColor clearColor];
        self.songNameLabel.textColor = [UIColor whiteColor];
        self.songNameLabel.font = [UIFont fontWithName:@"AmericanTypewriter-Bold" size:20.0];
//        self.songNameLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:_songNameLabel];
        [_songNameLabel release];
        
        
        
        self.singerNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_songNameLabel.frame.origin.x, _songNameLabel.frame.origin.y + _songNameLabel.frame.size.height - 10, 120*OffWidth, 40*OffHeight)];
        _singerNameLabel.backgroundColor = [UIColor clearColor];
        _singerNameLabel.font = [UIFont systemFontOfSize:17];
        self.singerNameLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:_singerNameLabel];
        [_singerNameLabel release];
        
        
        self.heart = [[UIImageView alloc] initWithFrame:CGRectMake(_singerNameLabel.frame.size.width + _singerNameLabel.frame.origin.x + 5, _singerNameLabel.frame.origin.y,25*OffWidth, 25*OffHeight)];
        self.heart.image = [UIImage imageNamed:@"xin.png"];
        [self.contentView addSubview:_heart];
        [_heart release];
        
        
        self.favoritesLabel = [[UILabel alloc]initWithFrame:CGRectMake(_heart.frame.size.width + _heart.frame.origin.x + 20, _heart.frame.origin.y, 80*OffWidth, 40*OffHeight)];
        self.favoritesLabel.backgroundColor = [UIColor clearColor];
        self.favoritesLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:_favoritesLabel];
        [_favoritesLabel release];
        
        
    }
    return self;
}

-(void)setValueWith:(MyMusicModel *)model
{
    self.songNameLabel.text = model.name;
    self.singerNameLabel.text = model.singerName;
    self.favoritesLabel.text = [NSString stringWithFormat:@"%@",model.favorites];

}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
